import { createStore } from 'vuex'

import { setItem, getItem } from '@/utils/storage.js'


const TOKEN_KEY = 'TOUTIAO_USER'
export default createStore({
    state: {
        user: getItem(TOKEN_KEY)
    },
    getters: {

    },
    mutations: {
        setUsers(state, data) {
            state.user = data

            //本地数据持久化存储
            setItem(TOKEN_KEY, data)
        }
    },
    actions: {},
    modules: {}
})